package fr.alesia.deepstack.data.jdo;

import javax.jdo.PersistenceManager;

import fr.alesia.deepstack.data.DataAccessObject;
import fr.alesia.deepstack.factory.DaoFactory;

public abstract class AbstractDao implements DataAccessObject {
	
	protected static PersistenceManager manager = null;
	
	protected AbstractDao(){}

	public void open() {
		
		manager = DaoFactory.getPersistenceManager();
	}
	
	public void close() {
		
		if(manager != null && !manager.isClosed()){
			manager.flush();
			manager.close();
		}
	}
}
